import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShopCashierQrcodeVO, ShopCashierQrcodeForm, ShopCashierQrcodeQuery } from '@/api/retail/shopCashierQrcode/types';

/**
 * 查询商店收银员二维码列表
 * @param query
 * @returns {*}
 */

export const listShopCashierQrcode = (query?: ShopCashierQrcodeQuery): AxiosPromise<ShopCashierQrcodeVO[]> => {
  return request({
    url: '/retail/shopCashierQrcode/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商店收银员二维码详细
 * @param id
 */
export const getShopCashierQrcode = (id: string | number): AxiosPromise<ShopCashierQrcodeVO> => {
  return request({
    url: '/retail/shopCashierQrcode/' + id,
    method: 'get'
  });
};

/**
 * 新增商店收银员二维码
 * @param data
 */
export const addShopCashierQrcode = (data: ShopCashierQrcodeForm) => {
  return request({
    url: '/retail/shopCashierQrcode',
    method: 'post',
    data: data
  });
};

/**
 * 修改商店收银员二维码
 * @param data
 */
export const updateShopCashierQrcode = (data: ShopCashierQrcodeForm) => {
  return request({
    url: '/retail/shopCashierQrcode',
    method: 'put',
    data: data
  });
};

/**
 * 删除商店收银员二维码
 * @param id
 */
export const delShopCashierQrcode = (id: string | number | Array<string | number>) => {
  return request({
    url: '/retail/shopCashierQrcode/' + id,
    method: 'delete'
  });
};
